package com.wechat.pojo;

import lombok.*;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
import java.util.List;

/**
 * Created by why on 2017/12/20 0020.
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "xml")
@XmlType(propOrder = {
        "toUserName",
        "fromUserName",
        "createTime",
        "msgType",
        "articleCount",
        "articles"
})
@Data
@AllArgsConstructor(access = AccessLevel.PUBLIC)
@NoArgsConstructor(access = AccessLevel.PUBLIC)
public class WechatImageTextMessage implements Serializable {
    @NonNull
    private String toUserName;
    @NonNull
    private String fromUserName;
    @NonNull
    private String createTime;
    @NonNull
    private String msgType;
    @NonNull
    private String articleCount;
    @NonNull
    private List<Article> articles;

    @Data
    @AllArgsConstructor(access = AccessLevel.PUBLIC)
    @NoArgsConstructor(access = AccessLevel.PUBLIC)
    public static class Article implements Serializable {
        private static final long serialVersionUID = -1376626671372470690L;
        @NonNull
        private List<Item> items;

        @Data
        @AllArgsConstructor(access = AccessLevel.PUBLIC)
        @NoArgsConstructor(access = AccessLevel.PUBLIC)
        public static class Item implements Serializable {
            private static final long serialVersionUID = 3565098823320728008L;
            @NonNull
            private String title;
            @NonNull
            private String description;
            @NonNull
            private String picUrl;
            @NonNull
            private String url;
        }
    }
}
